# -*- coding: utf-8 -*-
import os,sys
from pyh2 import *
page = PyH('SpeedReport')#第一步：需要先生成含标题的HTML模板
# <meta charset="utf-8">
page << meta(charset='utf-8')
page.addCSS('static/css/bootstrap.min.css')#第二步：需要加载我们要使用的Bootstrap模板css文件，需要的话还可以加载js
page.addJS('static/js/jquery-3.3.1.min.js', 'static/js/bootstrap.min.js','static/js/mySpeed.js')

Container = page << body(id='Body', cl='bg-warning') << div(id="container",cl="container") #第三步：通过移位符“<<”，来生成所属标签；“<<”左侧最终必须是page
# 报告标题 start
Headrow = Container << div(id="Headrow", cl="row")
Headrow << h1(id="HeadH1",align="center") << p("SpeedIndex Test  [Top10]",id="HeadTxt") #+ span("chrome63", id="author")
Headrow << br()
# 报告标题 end

Totalrow = Container << div(id="Totalrow", cl="Totalrow") << div(cl="jumbotron")
# --测试概述
Hwbrowser = ["HW：",'HWbrowser_B522']
Chrome = ["Chrome：",'Chrome63_Kernel']
UCbrowser = ["UC：",'UCbrowser63_Kernel']
UTimerow = Totalrow << div(id="UTimerow", cl="row")
UTimerow << div(cl="col-md-12 col-md-4") << p(role="presentation") << span(Hwbrowser[0]) << span(Hwbrowser[1], cl="label label-danger")
UTimerow << div(cl="col-md-12 col-md-4") << p(role="presentation") << span(Chrome[0]) << span(Chrome[1], cl="label label-primary")
UTimerow << div(cl="col-md-12 col-md-4") << p(role="presentation") << span(UCbrowser[0]) << span(UCbrowser[1], cl="label label-warning")
# end

Pngtainer = page << body(id='Pngtainer')
enlarge = Pngtainer << div(id='zoom') << img(id='f',width='800')
image = Pngtainer << div(id="image")

pnglist = os.listdir(os.path.join(os.getcwd(),'pngfile'))

for i in pnglist:
	image << img(id="img",onmouseover="divIn(event)",onmouseout="divOut(event)",onmousemove="divIn(event)",cl="col-md-12 col-md-3",src='pngfile/%s'%i)

page.printOut('Speed_report.html')